<#macro formcombourl name label datatype filed required="" cwidth="300px">
	<input id="form_${name}" name="form.${name}" class="easyui-combobox" data-options="label:'${label}：',labelAlign:'right',buttonAlign: 'left',url:'${request.contextPath}/data?type=${datatype}&filed=${filed}' ${required}" style="width:${cwidth}"> 
</#macro>

<#macro formcombolist name label required="" cwidth="300px">
	<select id="form_${name}" name="form.${name}" class="easyui-combobox" data-options="label:'${label}：',labelAlign:'right',buttonAlign: 'left' ${required}" style="width:${cwidth}">
		<#nested> 
	</select> 
</#macro>

<#macro createdialog createattributes>
 <div style="display: none;">
<div id="createDialog">
	<form id="dataForm">
		<div style="display: none;"><input id="form_id" name="form.id" class="form-id" value=""></div>
		<#list createattributes  as item>
			 <#assign required=" ">
				 <#if item.required??&&item.required=="true">
				 	<#assign required=",required:true">
				 </#if>
				<#assign index=item_index+1>
				<#assign cwidth="300px">
				<#switch item.type>
				  <#case "text">
				    <input id="form_${item.name}" name="form.${item.name}" class="easyui-textbox" data-options="label:'${item.label}：',labelAlign:'right'${required}" style="width:${cwidth}"> 
				    <#break>
				  <#case "email">
				  	<input id="form_${item.name}" name="form.${item.name}" class="easyui-textbox" data-options="label:'${item.label}：',labelAlign:'right', validType:['email','length[0,20]']${required}" style="width:${cwidth}">
				    <#break>
				  <#case "number">
				    <input id="form_${item.name}" name="form.${item.name}" class="easyui-numberbox" data-options="label:'${item.label}：',labelAlign:'right'${required}" style="width:${cwidth}"> 
				    <#break>
				  <#case "file">
				    <input id="form_${item.name}" name="form.${item.name}" class="easyui-filebox" data-options="label:'${item.label}：',labelAlign:'right',buttonText: '选择文件', buttonAlign: 'left' ${required}" style="width:${cwidth}"> 
				    <#break>
				  <#case "photo">
				    <input id="form_${item.name}" name="form.${item.name}" class="easyui-filebox" data-options="label:'${item.label}：',labelAlign:'right',buttonText: '选择文件', buttonAlign: 'left',accept:'image/jpeg' ${required}" style="width:${cwidth}"> 
				    <#break>
				  <#case "id">
				  	<@formcombourl name=item.name label=item.label datatype=item.source filed=item.filed required=required cwidth=cwidth/> 
				    <#break>  
				  <#case "list">
				  	<@formcombolist name=item.name label=item.label required=required cwidth=cwidth>
				  		<#list item.list as option>
				    		<option value="${option.value}">${option.text}</option>
				    	</#list>
				  	</@formcombolist>
				    <#break>
				  <#default>
				   	<input id="form_${item.name}" name="form.${item.name}" class="easyui-textbox" data-options="label:'${item.label}：',labelAlign:'right'${required}" style="width:${cwidth}"> 
				</#switch>			
				<br/>
		</#list>
		<div id="amssage" align="center"></div>
		<div align="center">
		  <button type="button"  name="btnClose"  class="btn btn-primary btn-sm close-dialog" >关闭</button>
		  <button type="button" name="btnSubmit" class="btn btn-primary btn-sm" onclick="submitForm()">提交</button>
		</div>
	</form>
</div>
</div>
<script type="text/javascript">
$(function(){
	$("#dataForm").form("clear");
	$('#createDialog').dialog({    
	    title: '创建',    
	    width: 350,    
	    height: "auto",    
	    cache: false,    
	    closed:true,resizable:true,modal:true,onClose:function(){
	    	$("#dataForm").form("clear");
	    	$("#amssage").text("");
	    }
	});
});
</script>
</#macro>